<?php //require_once '../view/header.php'; 
      require_once '../../../Components/Config.inc.php'; 
      global $config;
      //die('esto es-> '.$config['emailDeveloper']);
?>
<?php 
    $idInfraction=base64_decode($_GET['idInfraction']);
    global $config;                  
   // $columns='*';
    $table=$config['tableInfraction'];  
    //die('esto es-> '.$table);
    $condition="'".$idInfraction."'";
    $query="select * from $table where id_infraccion= $condition";
    $objDb=new Class_Db();
    $objDb->selectManager()->connect();
    //die($columns.''.$table.''.$condition);
    //$consult=$objDb->selectManager()->selectAdd($columns, $table, $condition);    
    $consult=$objDb->selectManager()->select($query);
    //die('es'.$consult[0][4]);
?>
<form action="/app_registro_vehiculos/principal.php?controller=Infraction&action=modify" method="post">
    <center>
        <fieldset style="width: 250px">                
            <table>
                <tr>
                    <td>CODIGO DE INFRACCION</td>
                    <td><input type="text" name="infraccion" value="<?php echo $consult[0][0]; ?>" readonly required placeholder="INFRACCION" autofocus maxlength="8" onkeypress="onlyNumbers();"/></td>
                </tr>
                <tr>
                    <td>PLACA</td>
                    <td><input type="text" name="placa" value="<?php echo $consult[0][1]; ?>" required placeholder="PLACA" onkeypress="onlyLetters();" /></td>
                </tr>
                <tr>
                    <td>TIPO</td>
                    <td>
                        <?php //$objDb= new Class_Db();
                                  $objDb->selectManager()->connect();
                                  $query2="select id_tipo,descripcion from tipo_infraccion";
                                  $consult1=$objDb->selectManager()->select($query2);
                                  //die('ddd'.count($consult));
                        ?>
                        <select  name="tipo" >
                            <?php
                            for($i=0;$i<count($consult1);$i++){  
                                       if($consult1[$i][0]==$consult[0][2]){
                                           
                            ?>
                                         <option value="<?php echo $consult1[$i][0] ?>" selected><?php echo $consult1[$i][1] ?></option>
                            <?php      }else {?>
                                         <option value="<?php echo $consult1[$i][0] ?>" ><?php echo $consult1[$i][1] ?></option>
                            <?php      }
                            
                            }?>
                        </select>
                    </td>
                </tr>
                
                <tr>
                    <td>INFRACTOR</td>
                    <td><input type="text" name="infractor" value="<?php echo $consult[0][3]; ?>" required placeholder="INFRACTOR" /></td>
                </tr>
                <tr>
                    <td>FECHA</td>
                    <td><input type="date" name="fechaInfraccion" value="<?php echo $consult[0][4]; ?>" required placeholder="FECHA" /></td>
                </tr>
                <tr>
                    <td>LUGAR DE INFRACCION</td>
                    <td><input type="text" name="lugar" value="<?php echo $consult[0][5]; ?>" required placeholder="LUGAR" /></td>
                </tr>
                <tr>
                    <td>PRECIO</td>
                    <td><input type="text" name="precio" value="<?php echo $consult[0][6]; ?>" required placeholder="PRECIO" onkeypress="onlyNumbers();" /></td>
                </tr>
                <tr>
                    <td>DESCRIPCION</td>
                    <td><input type="text" name="descripcion" value="<?php echo $consult[0][7]; ?>" required placeholder="DESCRIPCION" /></td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="Guardar"  />
                    </td>
                </tr>
            </table>                
        </fieldset>             
    </center>
 </form>
<center>
   <!-- <div style="text-align: center">
        <?php include_once '../view/botonInicio.php'; ?>
    </div>-->
</center>
